package com.client.entity;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.Date;

//消息类型
@AllArgsConstructor
@Getter
@Setter
public class Message {
    private String uid;    //该消息的唯一标识符
    private String ip;      //目标IP
    private Integer port;   //目标UDP端口
    private byte[] msg;
    private Date time;      //如果是对收到的消息进行回复，则是收到消息的时间；如果是发出的消息
    private int count = 0;  //已重发包的次数
    private int interval_time;  //重发包的间隔时间  秒
    private int timeout;    //超时时间  秒
//    private int isSuccessed = 0;    //是否发送成功    0发送中 1成功 -1失败

    public Message(String uid, String ip, Integer port, byte[] msg, Date time, int interval_time, int timeout) {
        this.uid = uid;
        this.ip = ip;
        this.port = port;
        this.msg = msg;
        this.time = time;
        this.interval_time = interval_time;
        this.timeout = timeout;
        this.count = 0;
    }

    public void addCount() {
        this.count++;
    }
//
//    public void sendSuccessd() {
//        this.isSuccessed = 1;
//    }
//    public void sendFalsed() {
//        this.isSuccessed = -1;
//}
}
